const { Service, } = require('egg')

class TopicService extends Service {
  async create(topic) {
    const { app } = this
    const result = await app.mysql.insert('t_topic', topic)
    return result
  }

  async getTopics() {
    const { app } = this
    const result = await app.mysql.select('t_topic', {})
    return result
  }

  async getTopic(topicId) {
    const { app } = this
    const result = await app.mysql.get('t_topic', { topicId })
    return result
  }
}

module.exports = TopicService
